import { axios } from "@/utils/request";
import { baseUrl } from "@/services/baseUrl";

//勘测设计管理-列表
export function pageSurveyDesign(data) {
  let { page, pageSize } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/managementSurveyDesign/getPageSet?pageNo=${page}&pageSize=${pageSize}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}
//测量报告-列表
export function pageMeasure(data) {
  let { page, pageSize } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/managementSurveyDesignMeasurementReport/getPageSet?pageNo=${page}&pageSize=${pageSize}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}
//测量报告-设计变更管理
export function pageVary(data) {
  let { page, pageSize } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/managementSurveyDesignChange/getPageSet?pageNo=${page}&pageSize=${pageSize}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}

//投资管理-下载模版
export function downloadInvestTemplate() {
  return axios({
    url: baseUrl + `/probusiness/investmentManagement/downloadTemplate`,
    method: "GET",
    apiType: "file",
    responseType: "arraybuffer",
  });
}

//投资管理-导入模版
export function importInvestExcel(file, callback) {
  return axios({
    url: baseUrl + `/probusiness/investmentManagement/importFile`,
    method: "POST",
    headers: {
      "Content-Type": "multipart/form-data",
    },
    data: file,
    // onUploadProgress: (progressEvent) => {
    //   let persent = ((progressEvent.loaded / progressEvent.total) * 100) | 0; //上传进度百分比
    //   callback(persent);
    // },
  });
}

//投资管理-新增/编辑
export function investAddOrUpdate(data) {
  return axios({
    url: baseUrl + `/probusiness/investmentManagement/saveOrUpdate`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}
//投资管理-列表
export function pageInvest(data) {
  let { page, pageSize } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/investmentManagement/getPageSet?pageNo=${page}&pageSize=${pageSize}&order=desc&sort=createTime`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}
//投资管理-详情
export function detailInvest(data) {
  let { uuid } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/investmentManagement/getDetailByUuid?uuid=${uuid}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
  });
}
//投资管理-删除
export function deleteInvest(data) {
  let { uuid } = data;
  return axios({
    url:
      baseUrl + `/probusiness/investmentManagement/deleteBatch?uuids=${uuid}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
  });
}
//投资管理-统计
export function statisticsInvest(data) {
  return axios({
    url: baseUrl + `/probusiness/investmentManagement/statistics`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}
//投资管理-本月完成编辑
export function updateMonthCompleted(data) {
  return axios({
    url: baseUrl + `/probusiness/investmentManagement/updateMonthCompleted`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}
//投资管理- 季度填报
export function updateQuarter(data) {
  return axios({
    url: baseUrl + `/probusiness/investmentManagementDetail/updateQuarter`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}

//合同管理【列表】
export function pageContract(data) {
  let { page, pageSize } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/contractManagement/getPageSet?pageNo=${page}&pageSize=${pageSize}&order=desc&sort=createTime`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}
//合同管理【统计分析】
export function pageContractAnalysis(data) {
  let { page, pageSize } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/contractManagement/statistics?pageNo=${page}&pageSize=${pageSize}&order=desc&sort=createTime`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}

//合同管理-新增/编辑
export function contractAddOrUpdate(data) {
  return axios({
    url: baseUrl + `/probusiness/contractManagement/saveOrUpdate`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}
//合同管理-删除
export function deleteContract(data) {
  let { uuid } = data;
  return axios({
    url: baseUrl + `/probusiness/contractManagement/deleteBatch?uuids=${uuid}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
  });
}
//合同管理-详情
export function detailContract(data) {
  let { uuid } = data;
  return axios({
    url:
      baseUrl + `/probusiness/contractManagement/getDetailByUuid?uuid=${uuid}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
  });
}
//合同管理-付款进度-列表
export function contractPayment(data) {
  return axios({
    url: baseUrl + `/probusiness/contractPayment/getList`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}
//合同管理-付款进度-保存
export function contractPaymentSave(data) {
  return axios({
    url: baseUrl + `/probusiness/contractPayment/saveOrUpdate`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}
//合同管理-付款进度-删除
export function deleteContractPayment(data) {
  let { uuid } = data;
  return axios({
    url: baseUrl + `/probusiness/contractPayment/deleteBatch?uuids=${uuid}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
  });
}
//合同管理-季度填报
export function listByDataId(data) {
  return axios({
    url: baseUrl + `/probusiness/investmentManagementDetail/listByDataId`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}

//项目概况列表
export function pageProjectOverview(data) {
  let { page, pageSize } = data;
  return axios({
    url:
      baseUrl +
      `/mdata/sysProject/getPageSet?pageNo=${page}&pageSize=${pageSize}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}

//设计成果提交-列表
export function pageDesignResultSubmit(data) {
  let { page, pageSize } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/designResult/getPageSet?pageNo=${page}&pageSize=${pageSize}&order=desc&sort=createTime`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}

//环保数据管理-分页
export function pageEnvironmentManage(data) {
  let { page, pageSize } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/environmentData/getPageSet?pageNo=${page}&pageSize=${pageSize}&order=desc&sort=createTime`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}
//环保数据管理-配置
export function environmentConfig(data) {
  return axios({
    url: baseUrl + `/probusiness/bigScreen/getConfig?uuid=5`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}

//项目总览-导出
export function exportProjectExcel(data = {}) {
  return axios({
    url: baseUrl + `/mdata/sysProject/exportExcel`,
    method: "POST",
    apiType: "file",
    responseType: "arraybuffer",
  });
}

//投资进度填报-分页
export function pageInvestSchedule(data) {
  let { page, pageSize } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/investmentManagementMonth/getPageSet?pageNo=${page}&pageSize=${pageSize}&order=desc&sort=monthName`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}
//投资进度填报-保存
export function investScheduleSave(data) {
  return axios({
    url: baseUrl + `/probusiness/investmentManagementMonth/save`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}
//投资进度填报-编辑
export function investScheduleUpdate(data) {
  return axios({
    url: baseUrl + `/probusiness/investmentManagementMonth/update`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}
//投资进度填报-删除
export function deleteInvestSchedule(data) {
  let { uuid } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/investmentManagementMonth/deleteBatch?uuids=${uuid}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
  });
}

//投资进度-统计
export function investStatistics(data) {
  return axios({
    url: baseUrl + `/probusiness/investmentManagementMonth/getChartData`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}

//投资管理-导出
export function exportInvestScheduleExcel(data = {}) {
  let { type } = data;
  return axios({
    url: baseUrl + `/probusiness/investmentManagement/exportExcel?type=${type}`,
    method: "POST",
    apiType: "file",
    responseType: "arraybuffer",
  });
}

//图纸管理-版本列表
export function getDrawingVersionList(data) {
  let { uuid } = data;
  return axios({
    url: baseUrl + `/probusiness/bimCadFile/getListByMainId?mainId=${uuid}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
  });
}

//图纸管理-动态表头
export function getDynamicsHeader(data) {
  return axios({
    url: baseUrl + `/probusiness/bimCadProject/getTableHead`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}
//图纸管理-列表数据
export function pageDynamicsBody(data) {
  let { page, pageSize } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/bimCadProject/getPageSet?pageNo=${page}&pageSize=${pageSize}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}

//图纸管理-下载
export function exportZip(data) {
  let { classifyId } = data;
  return axios({
    url:
      baseUrl + `/probusiness/bimCadProject/exportZip?classifyId=${classifyId}`,
    method: "POST",
    apiType: "file",
    responseType: "arraybuffer",
  });
}
//过滤项目树
export function filterProjectTreeList(data) {
  const { type } = data;
  return axios({
    url: baseUrl + `/probusiness/bimCadProject/getProListByQX?type=${type}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data: {},
  });
}
